﻿using System.Windows;

namespace FireFly
{
    /// <summary>
    /// Context of RelayCommand execution. 
    /// <typeparam name="TViewModel">type of view model, which contains command</typeparam>
    /// <typeparam name="TContext">type of the UIContext</typeparam>
    /// </summary>
    public sealed class CommandExecutionContext<TViewModel, TContext> 
        where TViewModel : IViewModel
    {
        /// <summary>
        /// Command which is running
        /// </summary>
        public RelayCommand<TViewModel, TContext> Command
        {
            get;
            set;
        }

        /// <summary>
        /// View model as a subject of execution
        /// </summary>
        public TViewModel ViewModel
        {
            get;
            set;
        }

        /// <summary>
        /// UI element which starts command execution
        /// </summary>
        public DependencyObject Sender
        {
            get;
            set;
        }

        /// <summary>
        /// PlacementTarget, if command is executing via context menu
        /// </summary>
        public UIElement PlacementTarget
        {
            get;
            set;
        }

        /// <summary>
        /// Application context which command can use while executing
        /// </summary>
        public TContext AppContext
        {
            get;
            set;
        }
    }
}